package cn.sangyy.basic.raabbitmq.handler;

import cn.sangyy.basic.dto.SmsDto;
import cn.sangyy.basic.raabbitmq.config.RegisterNoticeRabbitmqConfig;
import cn.sangyy.basic.utils.SmsUtils;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

@Component
public class RegisterNoticeSmsReceiveHandler {
    //监听短信队列
    @RabbitListener(queues = {RegisterNoticeRabbitmqConfig.QUEUE_INFORM_SMS})
    public void receive_sms(SmsDto smsDto) {
        //使用短信技术进行发送
        SmsUtils.sendSms(smsDto.getPhone(),smsDto.getContext());
    }
}